import React, { Component } from 'react'
import { Route, Redirect } from 'react-router-dom'
import Details from './Details'
export default class News extends Component {
    clickChild = item => {
        this.props.history.push({pathname:'/home/news/details',state:{id:item.id || 1}})
    }
    render() {
        let arr = [
            {
                id:1,title:"你喜欢什么?"
            },
            {
                id:2,title:"你能坚持多长时间?"
            },
            {
                id:3,title:"我很大,你忍耐一下"
            },
        ]
        return (
            <div>
                <div>
                    <ul>
                        {
                            arr.map(child=><li key={child.id} onClick={()=>this.clickChild(child)}>{child.title}</li>)
                        }
                    </ul>
                </div>
                <div>
                    <Route path="/home/news/details" component={Details} />
                </div>
            </div>
        )
    }
}
